﻿<ResourceDictionary x:Class="CdcSoftware.Iaf.Presentation.Themes.InfoCard.Generic"
                    x:ClassModifier="internal"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Supremacy.Client.Controls">

  <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

  <Style TargetType="{x:Type controls:InfoCardWindowControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type controls:InfoCardWindowControl}">
          <ContentPresenter />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="{x:Type controls:InfoCard}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type controls:InfoCard}">
          <Border CornerRadius="2"
                  Background="#7f000000"
                  BorderBrush="DodgerBlue"
                  BorderThickness="1"
                  VerticalAlignment="Top">
            <Border CornerRadius="2"
                    BorderBrush="#7f666666"
                    BorderThickness="1">
              <DockPanel>
                <Border DockPanel.Dock="Top"
                        Background="Transparent"
                        CornerRadius="2,2,0,0">
                  <Grid DockPanel.Dock="Top">
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <ContentPresenter Margin="5"
                                      ContentSource="Header"
                                      TextBlock.Foreground="White" />
                    <StackPanel Grid.Column="1"
                                Orientation="Horizontal"
                                VerticalAlignment="Top">
                      <!--<ToggleButton Content="P"
                                      IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsPinned, Mode=TwoWay}"
                                      Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CanPin, Converter={StaticResource BooleanToVisibilityConverter}}" />-->
                      <controls:InlineWindowTitleBarButton x:Name="PinButton"
                                                             Content="P"
                                                             Margin="0,0,3,0"
                                                             MinWidth="16"
                                                             MinHeight="16"
                                                             Command="{x:Static controls:InfoCard.PinCommand}"
                                                             Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CanPin, Converter={StaticResource BooleanToVisibilityConverter}}" />
                      <controls:InlineWindowTitleBarButton Content="X"
                                                             MinWidth="16"
                                                             MinHeight="16"
                                                             Command="{x:Static controls:InfoCard.CloseCommand}" />
                    </StackPanel>
                  </Grid>
                </Border>
                <Grid DockPanel.Dock="Top"
                      Margin="0,2,0,0">
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                  </Grid.ColumnDefinitions>
                  <Rectangle Grid.Column="1"
                             Width="1"
                             HorizontalAlignment="Left"
                             Fill="White" />
                  <ToggleButton Grid.Column="1"
                                MinWidth="24"
                                Margin="2,0,0,0"
                                HorizontalAlignment="Right"
                                Content="..."
                                IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsExpanded, Mode=TwoWay}" />

                </Grid>
                <DockPanel x:Name="ExpansionSite"
                           LastChildFill="True"
                           Visibility="Collapsed">
                  <Rectangle DockPanel.Dock="Top"
                             Height="1"
                             Margin="0,2,0,2"
                             Fill="White" />
                  <ContentPresenter ContentSource="Content" />
                </DockPanel>
              </DockPanel>
            </Border>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsPinned"
                     Value="True">
              <Setter TargetName="PinButton"
                      Property="Command"
                      Value="{x:Static controls:InfoCard.UnpinCommand}" />
            </Trigger>
            <Trigger Property="IsExpanded"
                     Value="True">
              <Setter TargetName="ExpansionSite"
                      Property="Visibility"
                      Value="Visible" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>